package com.ruoyi.machine.base.fitting.service;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.machine.base.fitting.domain.Fitting;
import com.ruoyi.machine.base.fitting.domain.FittingCond;
import com.ruoyi.machine.base.fitting.mapper.FittingMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 配件
 */
@Service
public class FittingServiceImpl implements IFittingService {
    @Autowired
    private FittingMapper fittingMapper;

    /**
     * 根据搜索条件所有配件记录
     *
     * @param cond 搜索条件
     * @return
     */
    @Override
    public List<Fitting> selectFittingList(FittingCond cond) {
        return fittingMapper.selectFittingList(cond);
    }

    /**
     * 根据名称和规格查找配件
     * @return
     */
    @Override
    public Fitting selectFittingByName(String fittingName, String fittingSpecification) {
        return fittingMapper.selectFittingByName(fittingName, fittingSpecification);
    }

    /**
     * 添加配件
     * @param fitting
     * @return
     */
    @Override
    public int insertFitting(Fitting fitting) {
        return fittingMapper.insertFitting(fitting);
    }

    /**
     * 更新配件
     * @param fitting
     * @return
     */
    @Override
    public int updateFitting(Fitting fitting) {
        return fittingMapper.updateFitting(fitting);
    }

    /**
     * 删除配件
     * 仅修改删除标志
     * @param fitting
     * @return
     */
    @Override
    public int updateFittingDeleteFlag(Fitting fitting) {
        return fittingMapper.updateFittingDeleteFlag(fitting);
    }
}
